<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:wicket="http://wicket.apache.org/">
<!--
  ~ (c) 2024 Open Source Geospatial Foundation - all rights reserved
  ~ This code is licensed under the GPL 2.0 license, available at the root
  ~ application directory.
  ~
  -->
<body>
<wicket:head>
    <style type="text/css">
        ul.horizontal div {
            display: inline;
        }
    </style>
    <script>
        // When the user name format dropdown is changed, we hide
        // the "json path" input if its not needed.
        function usernameFormatChanged() {
            var elem = document.getElementById("userNameFormatSelect")
            if (elem.value === "JSON" || elem.value === "JWT") {
                document.getElementById("userNamePathDiv").style.display = "block";
            } else {
                document.getElementById("userNamePathDiv").style.display = "none";
            }
        }

        function showTokenValidationChanged() {
            var elem = document.getElementById("validateToken")
            var div = document.getElementById("validateTokenDiv");
            if (elem.checked) {
                div.style.display = "block";
            } else {
                div.style.display = "none";
            }
        }

        function toggleVisible(element,id) {
            var visibilityDiv = document.getElementById(id);
            if (element.checked)
                visibilityDiv.style.display = "block";
            else
                visibilityDiv.style.display = "none";
        }

        function reset() {
            usernameFormatChanged();
            showTokenValidationChanged();
            toggleVisible(document.getElementById('validateTokenSignature'),'validateTokenSignatureURLDiv');
            toggleVisible(document.getElementById('validateTokenAgainstURL'),'validateTokenAgainstURLDiv');
            toggleVisible(document.getElementById('validateTokenAudience'),'validateTokenAudienceDiv');
        }

        // When the page is loaded, we hide  the username "json path" input if its not needed.
        window.addEventListener('load', function () {
                reset();
        });

        // when creating a new jwt headers filter, we need to "kick" it.
        setTimeout(reset,100);
    </script>
</wicket:head>
<wicket:extend>
    <fieldset>
        <legend>
            <span><wicket:message key="UsernameHeader"></wicket:message></span>
            <a class="help-link" href="#" wicket:id="UsernameHelp"></a>
        </legend>
        <label>
            <wicket:message key="userNameHeaderAttributeName"></wicket:message>
        </label>
        <input class="field text" wicket:id="userNameHeaderAttributeName"/>
        <br>
        <label>
            <wicket:message key="formatUserName"></wicket:message>
        </label>
        <select class="select" id="userNameFormatSelect" onchange="usernameFormatChanged()"
                wicket:id="userNameFormatChoice"></select>
        <br>
        <!-- visibility of this DIV is control with JS, above.
              If formatUserName = "STRING" - don't show
              Otherwise (JSON or JWT), then show.
         -->
        <div id="userNamePathDiv">
            <label>
                <wicket:message key="userNamePath"></wicket:message>
            </label>
            <input class="field text" wicket:id="userNameJsonPath"/>
        </div>

        <br>
        <legend>
            <span><wicket:message key="validateTokenHeader"></wicket:message></span>
            <a class="help-link" href="#" wicket:id="validateTokenHelp"></a>
        </legend>

        <div style="display:flex">
            <input class="field checkbox" id="validateToken" onchange="showTokenValidationChanged()"
                   style="margin-top:auto;margin-bottom:auto" type="checkbox" wicket:id="validateToken"/>
            <label style="padding-left:5px">
                <wicket:message key="showTokenValidation"></wicket:message>
            </label>
        </div>
        <div id="validateTokenDiv" style="padding-top:5px;padding-left:20px">
        <div  style="padding-top:20px">
            <div style="display:flex">
                <input class="field checkbox" id="validateTokenExpiry"
                       style="margin-top:auto;margin-bottom:auto" type="checkbox" wicket:id="validateTokenExpiry"/>
                <label style="padding-left:5px">
                    <wicket:message key="validateTokenExpiry"></wicket:message>
                </label>
            </div>

        </div>



            <div style="display:flex;padding-top:20px">
                <input class="field checkbox" id="validateTokenSignature" onchange="toggleVisible(this,'validateTokenSignatureURLDiv')"
                       style="margin-top:auto;margin-bottom:auto" type="checkbox" wicket:id="validateTokenSignature"/>
                <label style="padding-left:5px">
                    <wicket:message key="validateTokenSignatureText"></wicket:message>
                </label>
            </div>
            <div id="validateTokenSignatureURLDiv" style="padding-left:20px;padding-top: 5px">
                <label>
                    <wicket:message key="validateTokenSignatureURL"></wicket:message>
                </label>
                <input class="field text" wicket:id="validateTokenSignatureURL"/>
            </div>


        <div  style="padding-top:20px">
            <div style="display:flex">
                <input class="field checkbox" id="validateTokenAgainstURL" onchange="toggleVisible(this,'validateTokenAgainstURLDiv')"
                       style="margin-top:auto;margin-bottom:auto" type="checkbox" wicket:id="validateTokenAgainstURL"/>
                <label style="padding-left:5px">
                    <wicket:message key="validateTokenAgainstURL"></wicket:message>
                </label>
            </div>
            <div id="validateTokenAgainstURLDiv" style="display: flex; padding-left: 20px;padding-top: 5px">

                <label>
                    <wicket:message key="validateTokenAgainstURLText"></wicket:message>
                </label>
                <div>
                    <input class="field text" wicket:id="validateTokenAgainstURLEndpoint"/>
                </div>
                <div style="display:flex">
                    <input class="field checkbox" id="validateSubjectWithEndpoint"
                           style="margin-top:auto;margin-bottom:auto" type="checkbox" wicket:id="validateSubjectWithEndpoint"/>
                    <label style="padding-left:5px">
                        <wicket:message key="validateTokenAgainstURLSubject"></wicket:message>
                    </label>
                </div>

            </div>
        </div>


        <div  style="padding-top:20px">
            <div style="display:flex">
                <input class="field checkbox" id="validateTokenAudience" onchange="toggleVisible(this,'validateTokenAudienceDiv')"
                       style="margin-top:auto;margin-bottom:auto" type="checkbox" wicket:id="validateTokenAudience"/>
                <label style="padding-left:5px">
                    <wicket:message key="validateTokenAudience"></wicket:message>
                </label>
            </div>
            <div id="validateTokenAudienceDiv" style="display: flex;padding-left: 20px;padding-top: 5px">
                <label>
                    <wicket:message key="validateTokenAudienceClaimName"></wicket:message>
                </label>
                <div>
                    <input class="field text" wicket:id="validateTokenAudienceClaimName"/>
                </div>
                <label>
                    <wicket:message key="validateTokenAudienceClaimValue"></wicket:message>
                </label>
                <div>
                    <input class="field text" wicket:id="validateTokenAudienceClaimValue"/>
                </div>

            </div>
            </div>
        </div>


    </fieldset>
</wicket:extend>
</body>
</html>